<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"/>
		<title></title>
		<style>
			body {
				background: #ccc;
				font-size: 20px;
			}
			#img {
				position: absolute;
				top: 50%;
				left: 50%;
				margin-top: -150px;
				margin-left: -200px;
			}
			#fff {
				width: 300px;
				height: 200px;
				border: 1px solid #ccc;
				overflow: auto;
			}
		</style>
	</head>
	<body>
		<input type="button" value="反选按钮" id="btn"/>
		<label>
			<input type="checkbox" id="checkall"/>
			全选</label>
		<div id="checkd">
			<input type="checkbox"/>
			<br/>
			<input type="checkbox"/>
			<br/>
			<input type="checkbox"/>
			<br/>
			<input type="checkbox"/>
			<br/>
		</div>
		<textarea id="fff">
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

</textarea>
		<br/>
		<input type="button" value="残废" id="fea"/>
		<input type="button" value="可用" id="feb"/>

		<script>
			(function() {
				var i = 0, btn = document.getElementById("btn"), allinput = document.getElementById("checkall"), oCheck = document.getElementById("checkd").getElementsByTagName("input");
				allinput.onclick = function() {
					for ( i = 0; i < oCheck.length; i++) {
						oCheck[i].checked = this.checked;
					}
				}////////////全选按钮

				btn.onclick = function() {
					for ( i = 0; i < oCheck.length; i++) {
						oCheck[i].checked = !oCheck[i].checked;
					}
				}////////////反选按钮
			})();

			(function() {
				var ipt = document.getElementById("fff"), fea = document.getElementById("fea"), feb = document.getElementById("feb");
				function dsab() {
					ipt.disabled = "true";
				};
				dsab();
				fea.onclick = function() {
					dsab();
				};
				feb.onclick = function() {
					ipt.disabled = "";
				};
			})();
		</script>
	</body>
</html>